<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="企业列表" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="addData()"
                            ng-disabled="!btnPermission.companyAdd" title="{{!btnPermission.companyAdd?'无权限执行此操作':''}}">新增</button>
                    <button class="btn btn-operate m-r-xs" ng-click="delData('batch')"
                            ng-disabled="!btnPermission.companyDel" title="{{!btnPermission.companyDel?'无权限执行此操作':''}}">删除</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" title="配置表格列"
                                ng-click="switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                        <div class="btn btn-default base-color" ng-if="!!btnPermission.companyExport">
                            <div title="导出">
                                <i class="yb-icon ico-export-o"></i>
                            </div>
                            <ul class="more-tool">
                                <li yb-download download-url="exportParam.sectionUrl"
                                    download-param="exportParam.sectionParam" download-key="companyIds">
                                    <i class="yb-icon ico-export-o"></i> 导出
                                </li>
                                <li yb-download download-url="exportParam.allUrl"
                                    download-param="condition">
                                    <i class="yb-icon ico-export-o"></i> 导出全部
                                </li>
                            </ul>
                        </div>
                    </div>
                    <button class="btn-advance pull-right m-l-xs" ng-click="switchToolbar('AdvanceSearch')">高级搜索
                    </button>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" placeholder="企业名称"
                               ng-model="condition.companyName">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)"
                 reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix">
                        <label class="control-label">企业名称：</label>
                        <input type="text" class="form-control" ng-model="condition.companyName">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">组织机构代码：</label>
                        <input type="text" class="form-control" ng-model="condition.orgCode">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">企业简称：</label>
                        <input type="text" class="form-control" ng-model="condition.shortName">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">企业类型：</label>
                        <select class="form-control" ng-model="condition.companyType"
                                ng-options="item.code as item.name for item in companyTypeList">
                            <option value="">请选择</option>
                        </select>
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="toolbarConfig.showColConfig" ng-model="tableConfig" col-fixed="true"
                 has-check-col="true" set-tb-style="setFixedWidth()"></div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <thead>
                            <tr>
                                <th width="40" class="text-center th-check border-l-none">
                                    <div yb-check-box yb-checked="markInfo.allChecked" yb-click="selectAll()"></div>
                                </th>
                                <th ng-repeat="itemCol in tableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && !!itemCol.isFixed && itemCol.type !== 'operate'">
                                    <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.fixedWidth" fixed-width="tbStyle.scrollLeft"></div>
                                </th>
                                <th width="80" class="border-r-none">
                                    操作
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <thead>
                            <tr>
                                <th ng-repeat="itemCol in tableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                    <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.scrollWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index"
                                ng-class="{'row-selected': $index === markInfo.cueRow}" ng-click="selectRow($index)">
                                <td width="40" class="text-center border-l-none">
                                    <div yb-check-box yb-checked="item.isChecked" yb-click="selectSingle(item)"></div>
                                </td>
                                <td class="spill-dots border-l-none" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                    width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && !!itemCol.isFixed && itemCol.type !== 'operate'"
                                    title="{{item[itemCol.dataField]}}">
                                    {{item[itemCol.dataField]}}
                                </td>
                                <td width="80" class="font-0 border-l-none border-r-none">
                                    <button class="btn btn-operate m-r-xs" ng-click="editData(item)"
                                        ng-if="item.companyType!=='1'"
                                        ng-disabled="!btnPermission.companyEdit" title="{{!btnPermission.companyEdit?'无权限执行此操作':''}}">编辑</button>
                                    <button class="btn btn-operate m-r-xs" ng-click="delData('single',item.orgId)"
                                        ng-if="item.companyType!=='1'"   
                                        ng-disabled="!btnPermission.companyDel" title="{{!btnPermission.companyDel?'无权限执行此操作':''}}">删除</button>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index"
                                ng-class="{'row-selected': $index === markInfo.cueRow}"
                                ng-click="selectRow($index)">
                                <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                    width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                    title="{{item[itemCol.dataField]}}">
                                    {{item[itemCol.dataField]}}
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="{{tabFlag.name}}" active="activeFlag[1]" ng-if="activeFlag[1]">
            <div class="main-area d-t-35 d-b-60">
                <form name="form" class="main-wrap form-horizontal single-col p-t clearfix" novalidate>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>企业类型：</label>
                        <div class="col-xs-5 wrapper-none">
                            <select name="companyType" class="form-control" ng-model="detailInfo.companyType"
                                    ng-options="item.code as item.name for item in companyTypeList" required yb-focus>
                                <option value="">请选择</option>
                            </select>
                        </div>
                        <div class="col-xs-4 msg-block"
                             ng-show="form.companyType.$dirty || (form.companyType.$invalid && submitted)">
                            <div class="error-msg"
                                 ng-if="form.companyType.$error.required && !form.companyType.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>企业名称：</label>
                        <div class="col-xs-5 wrapper-none">
                            <div name="companyName" yb-form-clear
                                    ng-model="detailInfo.companyName"
                                    title="detailInfo.companyName"
                                    select-obj="selectGPSinfo()"
                                    clear-form="clearGPSinfo()"
                                    tips-name="供应商"
                                    form-require="true"></div>
                        </div>
                        <div class="col-xs-4 msg-block" ng-if="!detailInfo.companyName && submitted">
                            <div class="error-msg">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>组织机构代码：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="orgCode" class="form-control" ng-model="detailInfo.orgCode" yb-serial-no
                                   required yb-focus maxlength="20">
                        </div>
                        <div class="col-xs-4 msg-block"
                             ng-show="form.orgCode.$dirty || (form.orgCode.$invalid && submitted)">
                            <div class="error-msg"
                                 ng-if="form.orgCode.$error.required && !form.orgCode.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                            <div class="error-msg" ng-if="form.orgCode.$error.serialNo && !form.orgCode.focused">
                                <i class="yb-icon ico-times-circular"></i>只能输入数字、字母
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">企业简称：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="shortName" class="form-control" ng-model="detailInfo.shortName"
                                   maxlength="40">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>供货工厂：</label>
                        <div class="col-xs-5 wrapper-none">
                            <select class="form-control" name="factory" ng-model="detailInfo.factoryId" disabled
                                ng-options="item.code as item.name for item in factoryList" required yb-focus>
                                <option value="">请选择</option>
                            </select>
                        </div>
                        <div class="col-xs-4 msg-block"
                             ng-show="form.factory.$dirty || (form.factory.$invalid && submitted)">
                            <div class="error-msg"
                                 ng-if="form.factory.$error.required && !form.factory.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>权限模板：</label>
                        <div class="col-xs-5 wrapper-none">
                            <select name="moduleTeplateId" class="form-control" ng-model="detailInfo.moduleTeplateId"
                                    ng-options="item.id as item.name for item in moduleTemplate" required yb-focus>
                                <option value="">请选择</option>
                            </select>
                        </div>
                        <div class="col-xs-4 msg-block"
                             ng-show="form.moduleTeplateId.$dirty || (form.moduleTeplateId.$invalid && submitted)">
                            <div class="error-msg"
                                 ng-if="form.moduleTeplateId.$error.required && !form.moduleTeplateId.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>
                    <!-- <div class="form-group m-b-xs">
                        <label class="col-xs-2 control-label">是否条码化管理：</label>
                        <label class="col-xs-5 control-label p-l-n text-left">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.isBarcode" value="1" yb-disabled="tabFlag.type===1"
                                   yb-radio-name="是">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.isBarcode" value="0" yb-disabled="tabFlag.type===1"
                                   yb-radio-name="否">
                        </label>
                    </div>
                    <div class="form-group m-b-xs">
                        <label class="col-xs-2 control-label">是否审核退货申请：</label>
                        <label class="col-xs-5 control-label p-l-n text-left">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.isReturnAudit" value="1"
                                   yb-radio-name="是">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.isReturnAudit" value="0"
                                   yb-radio-name="否">
                        </label>
                    </div> -->
                    <div class="form-group">
                        <label class="col-xs-2 control-label">地址：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="address" class="form-control" ng-model="detailInfo.address"
                                   maxlength="50">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">邮编：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="zip" class="form-control" ng-model="detailInfo.zip" maxlength="6" yb-number-input>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">传真：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="fax" class="form-control" ng-model="detailInfo.fax" maxlength="20">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">联系人：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="contact" class="form-control" ng-model="detailInfo.contact" maxlength="30">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">联系电话：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="contactTel" class="form-control" ng-model="detailInfo.contactTel" yb-number-input
                                   maxlength="11">
                        </div>
                    </div>
                    <div class="form-group m-b-sm" ng-if="tabFlag.type === 0">
                        <label class="col-xs-2 control-label"></label>
                        <label class="col-xs-5 wrapper-none text-left danger-color">
                            注：新建企业初始密码为：SgcX!515
                        </label>
                    </div>
                </form>
            </div>
            <div class="bottom-area btn-bar single-col border-t clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(form.$valid)">保存</button>
                <button type="button" class="btn btn-default" ng-click="changeTab(0)">取消</button>
            </div>
        </div>
    </div>
</div>